#ifndef PRAXIS_SERVICES_GLOBAL_CONFIG_MANAGER_H_
#define PRAXIS_SERVICES_GLOBAL_CONFIG_MANAGER_H_

#include <praxis/core/backend_stubs.h>

#include <memory>
#include <string>

namespace praxis {
/**
 * @class CGlobalConfigManager
 * @brief Manages global system parameters stored in a separate config file.
 *
 * This service handles loading, saving, and providing access to system-wide
 * configurations that are not part of any specific recipe.
 */
class PRAXIS_API CGlobalConfigManager {
 public:
  /**
   * @brief Constructs the manager.
   * @param schema The sub-schema for `global_system_parameters`. It's used
   *        to apply default values for any missing parameters.
   */
  explicit CGlobalConfigManager(const json& schema);
  ~CGlobalConfigManager();

  CGlobalConfigManager(const CGlobalConfigManager&) = delete;
  CGlobalConfigManager& operator=(const CGlobalConfigManager&) = delete;

  /**
   * @brief Saves the current configuration data to its file.
   * @return True on success, false otherwise.
   */
  bool Save();

  /**
   * @brief Provides read/write access to the configuration data.
   * @return A reference to the internal JSON object holding the data.
   */
  json& GetData();

 private:
  struct Impl;
  std::unique_ptr<Impl> impl_;
};
}  // namespace praxis

#endif  // PRAXIS_SERVICES_GLOBAL_CONFIG_MANAGER_H_
